package com.huabo.contract.oracle.mapper;

import com.hbfk.util.PageInfo;
import com.huabo.contract.oracle.entity.TblContractInvoicesmanagemen;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huabo
 * @since 2022-03-14
 */
public interface TblContractInvoicesmanagemenMapper extends BaseMapper<TblContractInvoicesmanagemen> {

    @SelectProvider(type=TblContractInvoicesmanagemenMapperSqlConfig.class,method="findInvoiceInfoListForCollection")
    List<TblContractInvoicesmanagemen> findInvoiceInfoListForCollection(PageInfo<TblContractInvoicesmanagemen> pageInfo, TblContractInvoicesmanagemen invoice);

    @SelectProvider(type=TblContractInvoicesmanagemenMapperSqlConfig.class,method="findInvoiceInfoListForCollectionCount")
    Integer findInvoiceInfoListForCollectionCount(TblContractInvoicesmanagemen invoice);

    @SelectProvider(type=TblContractInvoicesmanagemenMapperSqlConfig.class,method = "findContractInvociesManaeMenPageInfo")
    List<TblContractInvoicesmanagemen> findContractInvociesManaeMenPageInfo(PageInfo<TblContractInvoicesmanagemen> pageInfo, TblContractInvoicesmanagemen invoice);

    @SelectProvider(type=TblContractInvoicesmanagemenMapperSqlConfig.class,method = "findContractInvociesManaeMenPageInfoCount")
    Integer findContractInvociesManaeMenPageInfoCount(TblContractInvoicesmanagemen invoice);

    @Select("SELECT * FROM TBL_CONTRACT_INVOICESMANAGEMEN TCI\n" +
            "LEFT JOIN TBL_CYHW_PROJECTBUDGET TCP ON TCI.BUDGETID = TCP.BUDGETID\n" +
            "WHERE INVOICEID = #{invoiceid}")
    TblContractInvoicesmanagemen getInvoiceid(BigDecimal invoiceid);

    @SelectProvider(type=TblContractInvoicesmanagemenMapperSqlConfig.class,method = "selectListCount")
    Integer selectListCount(TblContractInvoicesmanagemen oldInvoice);

    @UpdateProvider(type=TblContractInvoicesmanagemenMapperSqlConfig.class,method = "updateMergenEntity")
    void updateMergenEntity(TblContractInvoicesmanagemen oldInvoice);

    @InsertProvider(type=TblContractInvoicesmanagemenMapperSqlConfig.class,method = "saveMergenEntity")
    @Options(useGeneratedKeys=true, keyProperty="invoiceid", keyColumn="INVOICEID")
    void saveMergenEntity(TblContractInvoicesmanagemen oldInvoice);

    @Update("UPDATE TBL_CONTRACT_INVOICESMANAGEMEN SET INVOICESTATUS = #{status} WHERE INVOICEID = #{invoiceId}")
    void updateModifyInvoiceStatus(Integer invoiceId, Integer status);

    @Delete("DELETE FROM TBL_CONTRACT_INVOICESMANAGEMEN WHERE INVOICEID = #{invoiceId}")
    void removeInvoiceInfo(Integer invoiceId);

    @InsertProvider(type=TblContractInvoicesmanagemenMapperSqlConfig.class,method = "saveInvoicemanageMenTci")
    void saveInvoicemanageMenTci(TblContractInvoicesmanagemen tci);
}
